package com.sixth.service.impl;

import com.sixth.bean.vo.AdminDashboardVo;
import com.sixth.mapper.MarketGoodsMapper;
import com.sixth.mapper.MarketGoodsProductMapper;
import com.sixth.mapper.MarketOrderMapper;
import com.sixth.mapper.MarketUserMapper;
import com.sixth.service.AdminDashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName AdminDashboardServiceImpl
 * @Description TODO
 * @Author XiaoWJ
 * @Date 2022/9/6 21:22
 **/

@Service
public class AdminDashboardServiceImpl implements AdminDashboardService {


    @Autowired
    MarketGoodsMapper marketGoodsMapper;

    @Autowired
    MarketUserMapper marketUserMapper;

    @Autowired
    MarketGoodsProductMapper marketGoodsProductMapper;

    @Autowired
    MarketOrderMapper marketOrderMapper;
    @Override
    public AdminDashboardVo dashboard() {
        int goodsCount = marketGoodsMapper.selectGoodsCount();
        int userCount = marketUserMapper.selectUserCount();
        int goodsProductCount = marketGoodsProductMapper.selectGoodsProductCount();
        int orderCount = marketOrderMapper.selectOrderCount();

        AdminDashboardVo adminDashboardVo = new AdminDashboardVo(goodsCount, userCount, goodsProductCount, orderCount);

        return adminDashboardVo;
    }
}
